﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MicropleSoft.WmsApp.Library.ServiceFacade
{
    public partial class PurchaseOrderWrap
    {
        public bool IsNeedSaved()
        {
            if (this.PPurchaseOrder != null)
            {
                if (this.PPurchaseOrder.DomainObjectState == DomainEntityState.Added || this.PPurchaseOrder.DomainObjectState == DomainEntityState.Updated)
                {
                    return true;
                }
                if (this.PPurchaseOrderDetails != null && this.PPurchaseOrderDetails.Count > 0)
                {
                    return this.PPurchaseOrderDetails.Any(dtl => dtl.DomainObjectState == DomainEntityState.Added || dtl.DomainObjectState == DomainEntityState.Updated);
                }
            }
            return false;
        }
    }
}
